<?php
/*
 * 幻灯片小插件
 */
namespace Mobile\Widget;
use Think\Controller;
use Mobile\Model\focusModel;

class SlideWidget extends Controller {
    
    public $focusModel;
    
    public function __construct() {
        parent::__construct();
        $this->focusModel = new focusModel();
    }
    
    /*
     *幻灯片轮播
     */
    public function index(){
        layout(false);
        //获取幻灯片
        $where = array(
            "status" => 1,
            "position" => 1
        );
        $focus_list = $this->focusModel->getFocusLists($where);
        
        if(!empty($focus_list)){
            $this->assign('focus_list',$focus_list);
            $this->display("Slide/index");
        }
    }
    
    /*
     * 商品幻灯片
     */
    public function goods($goods){
        layout(false);
        //获取幻灯片
        $focus_list = json_decode($goods['goods_thumb'],true);
        if(!empty($focus_list)){
            $this->assign('focus_list',$focus_list);
            $this->display("Slide/goods");
        }
    }

     
}